home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / db / esm-3.1 / esm-3 / usr / local / sm / src / include / msgdefs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-05  |  9.1 KB  |  492 lines

  1. #ifndef _MSGDEFS_H_
  2. #define _MSGDEFS_H_
  3. /*
  4.  *   $RCSfile: msgdefs.h,v $  
  5.  *   $Revision: 1.2 $  
  6.  *   $Date: 1996/05/05 01:04:04 $      
  7.  */ 
  8. #ifndef __MSGDEFS_H__
  9. #define __MSGDEFS_H__
  10.  
  11. /**********************************************************************
  12. * EXODUS Database Toolkit Software
  13. * Copyright (c) 1991 Computer Sciences Department, University of
  14. *                    Wisconsin -- Madison
  15. * All Rights Reserved.
  16. *
  17. * Permission to use, copy, modify and distribute this software and its
  18. * documentation is hereby granted, provided that both the copyright
  19. * notice and this permission notice appear in all copies of the
  20. * software, derivative works or modified versions, and any portions
  21. * thereof, and that both notices appear in supporting documentation.
  22. *
  23. * THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY OF WISCONSIN --
  24. * MADISON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.  
  25. * THE DEPARTMENT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
  26. * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  27. *
  28. * The EXODUS Project Group requests users of this software to return 
  29. * any improvements or extensions that they make to:
  30. *
  31. *   EXODUS Project Group 
  32. *     c/o David J. DeWitt and Michael J. Carey
  33. *   Computer Sciences Department
  34. *   University of Wisconsin -- Madison
  35. *   Madison, WI 53706
  36. *
  37. *     or exodus@cs.wisc.edu
  38. *
  39. * In addition, the EXODUS Project Group requests that users grant the 
  40. * Computer Sciences Department rights to redistribute these changes.
  41. **********************************************************************/
  42.  
  43. /*
  44.  *    defines for the message passing subsystem
  45.  */
  46.  
  47. #include "lock.h"
  48. #include "tid.h"
  49.  
  50. /*
  51.  *    define the path index type
  52.  */
  53. typedef FOUR    RESOURCEID;
  54.  
  55.  
  56. /*
  57.  *  used for the readv and writev which read/write from multiple
  58.  *  memory buffers.  This sets the maximum number of buffers.
  59.  */
  60. #ifndef __linux__
  61. #define MAX_IOVEC    4
  62. #endif
  63.  
  64. #define IOVECENT struct iovec
  65.  
  66. typedef IOVECENT    IOVECTOR[MAX_IOVEC];
  67.  
  68.  
  69. /*
  70.  *    all messages must have this header
  71.  */
  72. typedef struct {
  73.     SHORT_MAGIC        version;    /* it's worth shortening this up */
  74.     UONE            type;
  75.     BOOL            replyRequested;    /* should server reply    */
  76.     union {
  77.         struct {
  78.             TID                tid;
  79.         } in;
  80.         struct {
  81.             FOUR            errno;
  82.             FOUR            linkTransError; /* reason for last trans
  83.                                                abort (from client link
  84.                                                structure on server) */
  85.             LSN                endOfLog;
  86.         } out;
  87.     } params;
  88.  
  89. } MSGHDR;
  90.  
  91.  
  92. /* 
  93.  * NB: increment this whenever the protocol changes
  94.  */
  95. #define MESSAGE_VERSION    ((SHORT_MAGIC)0x96c9)
  96.  
  97. /*
  98.  *    message type resource
  99.  */
  100. typedef struct {
  101.  
  102.     RESOURCEID        id;
  103.     UNIQUE            unique;
  104.  
  105. } RESOURCEBODY;
  106.  
  107.  
  108. /*
  109.  *    message type for user block requests
  110.  */
  111. typedef struct {
  112.     FID            fid; 
  113.     LOCKMODE    fidLockMode;  
  114.     LOCKMODE    pidLockMode;  
  115.     PID            pid;          
  116. } LOCKBODY;    
  117.  
  118. typedef struct {
  119.     PID            pid;          
  120.     TWO            page2size;       
  121.     PAGETYPE    pageType;
  122.     UONE        flags;    /* input/output parameter  - see also fi_msg.h */
  123. #define            PAGE_IS_NEW            0x20
  124. #define            REPLY_WITH_NEIGHBOR    0x40
  125. #define            REPLY_WITH_DATA        0x80
  126.  
  127.     LRC            pageLRC;  /* input/output parameter */
  128.     union {
  129.         struct {
  130.             LSN            __firstLSN;
  131.             LRC            __firstLRC;     
  132. #define FirstLSN  pageBodyUnion.writePageBody.__firstLSN
  133. #define FirstLRC  pageBodyUnion.writePageBody.__firstLRC
  134.         } writePageBody;
  135.         struct {
  136.             FID            __fid;
  137.             LOCKMODE    __pidLockMode;  
  138.             LOCKMODE    __fidLockMode;  /* input param - IO_ReadPage */
  139. #define Fid             pageBodyUnion.readPageBody_in.__fid
  140. #define PidLockMode     pageBodyUnion.readPageBody_in.__pidLockMode
  141. #define FidLockMode     pageBodyUnion.readPageBody_in.__fidLockMode
  142.         } readPageBody_in;
  143.         struct {
  144.             PID            __neighborPid;          
  145. #define NeighborPid pageBodyUnion.readPageBody_out.__neighborPid
  146.         } readPageBody_out;
  147.     } pageBodyUnion;
  148. } PAGEBODY;
  149.  
  150.  
  151. /*
  152.  *    message type for user block requests
  153.  */
  154. typedef struct {
  155.  
  156.     PID            pid;
  157.     UNIQUE        unique;
  158.     UFOUR        uniqueCount;
  159.  
  160. } UNIQUEBODY;
  161.  
  162.  
  163. /*
  164.  *    message type for user block requests
  165.  */
  166. typedef struct {
  167.  
  168.     FID            fid;
  169.     PID            pid;
  170.     FLAGS        flags;
  171.  
  172. } FILEBODY;
  173.  
  174.  
  175. /*
  176.  *    message type for user block requests
  177.  */
  178. typedef struct {
  179.  
  180.     FID            fid;
  181.     PID            pid;
  182.     PAGE2SIZE    page2size;
  183.     FLAGS        flags;
  184.     RESOURCEBODY    resource;
  185.  
  186. } SEQFILEBODY;
  187.  
  188.  
  189. /*
  190.  *    message type for user block requests
  191.  */
  192. typedef struct {
  193.  
  194.     FOUR            recordSize;
  195.     FLAGS            flags;
  196.     BOOL            eof;
  197.     RESOURCEBODY    resource;
  198.  
  199. } SEQRECORDBODY;
  200.  
  201.  
  202. /*
  203.  *    message for page allocation
  204.  */
  205.  
  206. typedef struct {
  207.     VOLID        volid;
  208.     TWO            page2size;
  209.     TWO            numPages;
  210.     TWO            pageType;
  211.     UONE        flags;        /* on dealloc, 1 indicates immediate     */
  212.     PID            nearPid;
  213.     union {
  214.         struct {
  215.             FID            fid;
  216.             UFOUR        uniqueCount;
  217.         } s_input;
  218.         struct {
  219.             UNIQUE        unique;
  220.             SHORTPID    logicalPredPid;
  221.         } s_output;
  222.     } slotted;
  223. } ALLOCBODY;
  224.  
  225.  
  226. typedef struct {
  227.  
  228.     PID            pid;
  229.     int            pageType;
  230.     BOOL        bitSet;
  231.  
  232. } CHECKBODY;
  233.  
  234.  
  235. /*
  236.  *    message type for disk requests
  237.  */
  238. typedef struct {
  239.  
  240.     /* char        volName[DEVNAMEMAX]; */ /* now separate data in msg */
  241.     VOLID        volid;
  242.     TWO            numCylinders;
  243.     TWO            tracksPerCylinder;
  244.     FOUR        pagesPerTrack;
  245.     FOUR        numFreePages;
  246.     FOUR        bitmapPages;
  247.     FOUR        numPages;
  248.     FOUR        logFileSize;
  249.     TWO            logFileBlock2size;
  250.     FLAGS        properties;
  251.  
  252. } STATVOLBODY;
  253.  
  254. typedef struct {
  255.     int            optionNameLength; 
  256.     int            formatLength;
  257.     VOLID        volid;          /* out  */
  258. } VOLUMEBODY;
  259.  
  260. typedef struct {
  261.     VOLID        volid;
  262.     FLAGS        volumeProperties;
  263.  
  264. } MOUNTBODY;
  265.  
  266. typedef struct {
  267.     int            operation; 
  268.     /*  ADMIN_CLIENT_LOG_OFF, ADMIN_SETVAR */
  269.     int            variable;
  270.     int            value;
  271. } ADMINBODY;
  272.  
  273.  
  274. typedef struct {
  275.  
  276.     VOLID    volid;
  277.     FOUR    dataSize;
  278.     FOUR    nameSize;
  279.     /* char    name[MAX_ROOTNAME_SIZE]; now separate data in message */
  280.     /* char    data[MAX_ROOTDATA_SIZE]; now separate data in message */
  281.  
  282. } ROOTBODY;
  283.  
  284.  
  285.  
  286. typedef struct {
  287.  
  288.     BOOL    loggingOn;        /* TRUE = logging on for this transaction */
  289.     TID        tid;            /* BEGIN_TRANS, ENTER_2PC return TID here */
  290.     BOOL    syncTrans;        /* TRUE = flush all locked pages */
  291.     int        lock_timeout;    /* # LOCK_WAIT_UNITs to await a lock;
  292.                                units are defined in the server */
  293.  
  294. } TRANSBODY;
  295.  
  296. typedef struct {
  297.     BOOL        initLRCisLSN;
  298.     PAGE2SIZE    logPage2size;
  299.     PAGE2SIZE    slottedPage2size;
  300.     PAGE2SIZE    lgPage2size;
  301.     PAGE2SIZE    lgDataPage2size;
  302.     PAGE2SIZE    btreePage2size;
  303.     PAGE2SIZE    indexDescPage2size;
  304.     PAGE2SIZE    minPage2size;
  305.     VOLID        volid;
  306.     SHORT_MAGIC softwareVersion; /* so we do not have to recompile
  307.                                   * everything in order to change 
  308.                                   * compatibility 
  309.                                   * The value of this is in softwareVersion.h
  310.                                   */
  311. } INITBODY;
  312.  
  313.  
  314. typedef struct {
  315.  
  316.     PID        pid;
  317.     FOUR    releaseLimit;
  318.     FOUR    reserved;
  319.     
  320. } QUERYPAGEBODY;
  321.  
  322. typedef struct {
  323.  
  324.     FID     fid;
  325.     FOUR    numPages;
  326.  
  327. } FILENUMPAGESBODY;
  328.  
  329.  
  330. /*
  331.  *    defines for administrative messages
  332.  */
  333.  
  334. /*
  335.  *    message type for user block requests
  336.  */
  337. typedef struct {
  338.  
  339.     FOUR    checkpointInterval;
  340.     TWO        numCheckpoint;        /* take this many checkpoints */
  341.  
  342. } CHECKPNTBODY;
  343.  
  344. /*
  345.  *    message for server shutdown (flags defined in adminmsg.h)
  346.  */
  347. typedef struct {
  348.  
  349.     FLAGS    shutdownFlags;
  350.  
  351. } SHUTDOWNBODY;
  352.  
  353. /*
  354.  *    message for obtaining server statistics 
  355.  *    (flags defined in adminmsg.h)
  356.  */
  357. typedef struct {
  358.  
  359.     FLAGS    flags;
  360.  
  361. } STATISTICSBODY;
  362.  
  363. /*
  364.  *    for distr trans
  365.  *    message for prepare requests from client to coordinator
  366.  */
  367. typedef struct {
  368.  
  369.     FOUR    numParticipants;
  370.     BOOL    prepareAndCommit;
  371.  
  372. } PREPAREBODY;
  373.  
  374.  
  375. /*
  376.  *    for distr trans
  377.  *    message for Enter2PC requests
  378.  */
  379. typedef struct {
  380.  
  381.     FOUR    length;
  382.  
  383. } ENTER2PCBODY;
  384.  
  385. /*
  386.  *    for distr trans
  387.  *    message for coordinator requesting the vote from a server 
  388.  */
  389. typedef struct {
  390.  
  391.     TID            coordTid;
  392.     TID            localTid;
  393. } VOTEREQBODY;
  394.  
  395. /*
  396.  *    for distr trans
  397.  *    message for returning the vote from a server to coordinator 
  398.  *  and from the coord to the client
  399.  */
  400. typedef struct {
  401.  
  402.     TID            coordTid;
  403.     TID            localTid;
  404.     UONE        vote;    /* UONE should actually be VOTE */
  405.  
  406. } VOTEBODY;
  407.  
  408. /*
  409.  *    for distr trans
  410.  *    message for coordinator commanding server to commit/abort 
  411.  *    or for client commanding coordinator to commit/abort 
  412.  */
  413. typedef struct {
  414.  
  415.     TID            coordTid;
  416.     TID            localTid;
  417.     UONE        command;    /* UONE should actually be COMMAND */
  418.  
  419. } COMMANDBODY;
  420.  
  421. /*
  422.  *    for distr trans
  423.  *    message for returning the ack from a server to coordinator 
  424.  */
  425. typedef struct {
  426.  
  427.     TID            coordTid;
  428.     TID            localTid;
  429.  
  430. } ACKBODY;
  431.  
  432.  
  433. typedef int DUMMYBODY;
  434.  
  435.  
  436. /*
  437.  *    union all the body types together
  438.  */
  439. typedef union {
  440.  
  441.     INITBODY        init;
  442.     PAGEBODY        page;
  443.     LOCKBODY        lock;
  444.     ADMINBODY        admin;
  445.     MOUNTBODY        mount;
  446.     VOLUMEBODY        volume;
  447.     STATVOLBODY        statvol;
  448.     ALLOCBODY        alloc;
  449.     CHECKBODY        check;
  450.     UNIQUEBODY        unique;
  451.     ROOTBODY        root;
  452.     TRANSBODY        trans;
  453.     FILEBODY        file;
  454.     SEQFILEBODY        seqfile;
  455.     SEQRECORDBODY    seqRecord;
  456.     RESOURCEBODY    resource;
  457.     QUERYPAGEBODY    lockQuery;
  458.     FILENUMPAGESBODY fileNumPages;
  459.     CHECKPNTBODY    checkpoint;
  460.     SHUTDOWNBODY    shutdown;
  461.     STATISTICSBODY    stats;
  462.     PREPAREBODY     prepare;    /* for distr trans */
  463.     ENTER2PCBODY    enter2pc;    /* for distr trans */
  464.     VOTEREQBODY     voteReq;    /* for distr trans */
  465.     VOTEBODY        vote;        /* for distr trans */
  466.     COMMANDBODY     command;    /* for distr trans */
  467.     ACKBODY         ack;        /* for distr trans */
  468.     DUMMYBODY        dummy;
  469.  
  470. } MSGBODY;
  471.  
  472.  
  473. typedef struct Message_s MESSAGE;
  474.  
  475. struct Message_s {
  476.  
  477.     MSGHDR        header;
  478.     MSGBODY        body;
  479.  
  480. };
  481.  
  482.  
  483. /*
  484.  * definitions of message types are moved to msgstats.h!!!!!!!
  485.  * msgstats.h also includes the msg stats structures and defs.
  486.  * shared between client and server, and the common lib.
  487.  */
  488. #include "msgstats.h"
  489.  
  490. #endif __MSGDEFS_H__
  491. #endif /* _MSGDEFS_H_ */
  492.